import request from '@/utils/request'

//统计工单状态
export function countWorkOrderState(params={}) {
  return request({
    url: '/enterprise/workOrder/workOrder/countState',
    method: 'get',
    params: params
  })
}

// 工单列表查询
export function listWorkOrder(params) {
  return request({
    url: '/enterprise/workOrder/workOrder/list',
    method: 'get',
    params: params
  })
}

// 获取工单详细信息
export function getWorkOrderDetail(workOrderId) {
  return request({
    url: '/enterprise/workOrder/workOrder/' + workOrderId,
    method: 'get'
  })
}

// 新增工单
export function addWorkOrder(data) {
  return request({
    url: '/enterprise/workOrder/workOrder',
    method: 'post',
    data: data
  })
}

// 修改工单上门时间
export function editVisitTime(data) {
  return request({
    url: '/enterprise/workOrder/workOrder/editEstimateTime',
    method: 'put',
    data: data
  })
}

//修改工单紧急程度
export function editUrgencyDegree(data) {
  return request({
    url: '/enterprise/workOrder/workOrder/editUrgencyDegree',
    method: 'put',
    data: data
  })
}

// 驳回工单、作废工单
export function rejectWorkOrder(data) {
  return request({
    url: '/enterprise/workOrder/workOrder/reject',
    method: 'put',
    data: data
  })
}
// 派单、改派工单
export function dispatchWorkOrder(data) {
  return request({
    url: '/enterprise/workOrder/workOrder/dispatch',
    method: 'put',
    data: data
  })
}

//新增跟进记录
export function addWorkOrderRecord(data) {
  return request({
    url: '/enterprise/workOrder/workOrder/addWorkOrderRecord',
    method: 'post',
    data: data
  })
}

//跟进记录列表
export function listWorkOrderRecord(params) {
  return request({
    url: '/enterprise/workOrder/workOrder/record/list',
    method: 'get',
    params: params
  })
}

//编辑已接单
export function editWorkOrdeBeingRepaired(data) {
  return request({
    url: '/enterprise/workOrder/workOrder/beingRepaired',
    method: 'put',
    data: data
  })
}
// 提交缴费单
export function submitPaymentSlip(workOrderId) {
  return request({
    url: '/enterprise/workOrder/workOrder/submitPaymentSlip/'+workOrderId,
    method: 'put',
  })
}
// 同意拒接
export function accessDenial(data) {
  return request({
    url: '/enterprise/workOrder/workOrder/revocation/accessDenial',
    method: 'put',
    data: data
  })
}
//审核拒接
export function auditDenial(data) {
  return request({
    url: '/enterprise/workOrder/workOrder/auditDenial',
    method: 'put',
    data: data
  })
}

// 上传缴费凭证
export function uploadPaymentDocument(data) {
  return request({
    url: '/enterprise/workOrder/workOrder/addPaymentDocument',
    method: 'post',
    data: data
  })
}

// 创建工单收款码
export function createPayPicture(workOrderId) {
  return request({
    url: '/enterprise/workOrder/workOrder/createPayPicture/'+workOrderId,
    method: 'get',
  })
}
// 导出工单
export function exportWorkOrder(data) {
  return request({
    url: '/enterprise/workOrder/workOrder/export',
    method: 'post',
    data: data
  })
}
// 接单员工单列表查询
export function listWorkOrderByMaintenance(params) {
  return request({
    url: '/enterprise/workOrder/workOrder/list/byPerson',
    method: 'get',
    params: params
  })
}

// 接单员接单
export function receiveWorkOrder(data) {
  return request({
    url: '/enterprise/workOrder/workOrder/received',
    method: 'put',
    data: data
  })
}

// 接单员申请拒接
export function requestRejectionWorkOrder(data) {
  return request({
    url: '/enterprise/workOrder/workOrder/requestRejection',
    method: 'put',
    data: data
  })
}

// 接单员撤销拒接申请
export function rejectionRevokeWorkOrder(data) {
  return request({
    url: '/enterprise/workOrder/workOrder/revocation/rejection',
    method: 'put',
    data: data
  })
}


